class Geoda::Polygon
  def initialize(*args)
    @object_ids = args if Geoda::Polygon.valid?(args)
  end

  def [] index
    ObjectSpace._id2ref(@object_ids[index]) if @object_ids
  end

  private

  def self.valid?(args)
    not args.map { |arg| arg.instance_of? Fixnum  }.include?(false)
  end

end